new Vue({
    el: '#app',
    data: {
        active: 2,
        tabActive: 0,
        loading: true,
        user: {},
        list: [],
        usdturl: '',
        tabs: [{
                title: '当前接单',
                list: [],
                loading: false,
                finished: false,
                page: 1,
                status: 1,
            }, {
                title: '历史接单',
                list: [],
                loading: false,
                finished: false,
                page: 1,
                status: 2,
            }]
    },
    mounted: function () {
        this.main();
    },
    methods: {
        main: function () {
            var _this = this;
            $http.get('/api/user/getUserInfo').then(function (res) {
                _this.user = res.data.data;
                return $http.get('/api/index/systemdeta');
            }).then(function (res) {
                _this.usdturl = res.data.data.usdturl;
            });
        },
        onLoad: function () {
            var tab = this.tabs[this.tabActive];
            $http.get('/api/otc/getallOrder', { status: tab.status, page: tab.page }).then(function (res) {
                var _a;
                if (!res.data.data || !res.data.data.length) {
                    tab.finished = true;
                    return;
                }
                tab.page++;
                tab.loading = false;
                (_a = tab.list).push.apply(_a, res.data.data);
            });
        },
        onTabChange: function () {
            var tab = this.tabs[this.tabActive];
            tab.list = [];
            tab.page = 1;
            tab.loading = false;
            tab.finished = false;
        },
        onCreateOrder: function () {
            location.href = './createOrder.html';
        }
    }
});
